package com.example.demo.线程池;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @description:
 * @projectName:demo
 * @see:线程池
 * @author:袁成龙
 * @createTime:2020/10/6 20:52
 * @version:1.0
 */
public class TestExecutor {

    public static void main(String[] args) {

        ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(2);
        //1,线程实例,2第一次运行的时间,3.每隔及=多长时间运行一次
        scheduledExecutorService.scheduleAtFixedRate(new TestThreadPool(),2,5, TimeUnit.SECONDS);
        //scheduledExecutorService.submit();
    }

}